<template>
	<!-- banner轮播 -->
	<view class="banner-wrapper">
		<swiper class="banner" :autoplay="true" :interval="3000" :duration="500" :circular="true" easing-function="easeInOutCubic" resistanceratio="0" :skipHiddenItemLayout="true">
			<swiper-item item-id="index" v-for="(banner, index) in bannerList" :key="index" class="swiper-item">
				<image :src="banner.fileUrl" @click="toGoods(banner)"></image>
			</swiper-item>
		</swiper>
	</view>
</template>

<script>
export default {
	props: ['bannerList'],
	data() {
		return {
			detailUrl: '/pages/goods_detail/goods_detail?goodsId=',
		};
	},
	methods: {
		toGoods(banner){
			uni.navigateTo({
				url: this.detailUrl + banner.goodsId
			});
		}
	}
};
</script>

<style scoped lang="less">
.banner-wrapper {
	padding: 0 15rpx;
}

.banner {
	height: 25vh;
	image {
		width: 100%;
		height: 100%;
		border-radius: 15rpx;
	}
	.swiper-item {
		margin: 0;
	}
}
</style>
